const DataTypes = require("sequelize").DataTypes;
// const { sequelize } = require('@core/db-postgres')
const { sequelize } = require('@core/db-hangao')

module.exports = function() {
  return sequelize.define('d_areacode_2020', {
    sheng: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    shi: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    xian: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    xiang: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    cun: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    code: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    level: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false
    }
  }, {
    sequelize,
    tableName: 'd_areacode_2022',
    schema: 'public',
    timestamps: false,
    indexes: [
      {
        name: "areacode_copy1",
        fields: [
          { name: "code" },
        ]
      },
      {
        name: "d_areacode_2021_copy1_pkey",
        unique: true,
        fields: [
          { name: "code" },
        ]
      },
    ]
  });
};
